package kr.saeildamil.androidstudy_second.draw;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

public class DrawMain extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		LinearLayout layout = new LinearLayout(this);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		Button btn01 = new Button(this);
		btn01.setText("Blur Filter");
		btn01.setOnClickListener(listener);
		btn01.setId(1);
		
		Button btn02 = new Button(this);
		btn02.setText("Reflection");
		btn02.setOnClickListener(listener);
		btn02.setId(2);
		
		Button btn03 = new Button(this);
		btn03.setText("SurfaceView");
		btn03.setOnClickListener(listener);
		btn03.setId(3);
		
		
		LinearLayout.LayoutParams params = new LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		
		layout.addView(btn01, params);
		layout.addView(btn02, params);
		layout.addView(btn03, params);
		setContentView(layout);
	}
	
	OnClickListener listener = new OnClickListener() {
		public void onClick(View v) {
			Intent intent = new Intent();
			switch(v.getId()){
			case 1:
				intent.setClass(DrawMain.this, BlurFilter.class);
				break;
			case 2:
				intent.setClass(DrawMain.this, Reflection.class);
				break;
			case 3:
				intent.setClass(DrawMain.this, Reflection2.class);
				break;
			}
			startActivity(intent);
		}
	};
}
